package com.heima.feigns.article;

import com.heima.model.article.dtos.ApArticleDto;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.article.pojos.ApArticleContent;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @Description:
 * @Version: V1.0
 */
@FeignClient("leadnews-article")
public interface ArticleFeign {

    @GetMapping("/api/v1/author/findByUserId/{id}")
    public ApAuthor findByUserId(@PathVariable("id") Integer id);

    @GetMapping("/api/v1/author/findApAuthorById/{id}")
    public ApAuthor findApAuthorById(@PathVariable("id") Integer id);


    @PostMapping("/api/v1/author/save")
    public boolean save(@RequestBody ApAuthor apAuthor);

    @PostMapping("/api/v1/article/save")
    public ResponseResult saveApArticle(@RequestBody ApArticleDto apArticleDto);

    @GetMapping("/api/v1/article_content/one/{id}")
    public ApArticleContent findArticleContentById(@PathVariable("id") Long articleId);

    @GetMapping("/api/v1/article/one/{id}")
    public ApArticle findArticleById(@PathVariable("id") Long articleId);

    @PutMapping("/api/v1/article/updateArticleById")
    public void updateArticleById(@RequestBody ApArticle apArticle);
}
